home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Fade Me 1.1 / source / sdf code ƒ / msg timing.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  1.3 KB  |  48 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        msg timing.c
  4.  
  5. Purpose:    This module handles timing loop corrections with TickCount()
  6.             so that time-sensitive procedures run the same speed on
  7.             all Macintoshes.
  8.             
  9.  
  10. Shutdown Fade -=- fade the screen to black on shutdown
  11. Copyright (C) 1993 Mark Pilgrim
  12.  
  13. This program is free software; you can redistribute it and/or modify
  14. it under the terms of the GNU General Public License as published by
  15. the Free Software Foundation; either version 2 of the License, or
  16. (at your option) any later version.
  17.  
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with this program in a file named "GNU General Public License".
  25. If not, write to the Free Software Foundation, 675 Mass Ave,
  26. Cambridge, MA 02139, USA.
  27.  
  28. \**********************************************************************/
  29.  
  30. #include "msg timing.h"
  31.  
  32. long        oldTicks;
  33.  
  34. void StartTiming(void)
  35. {
  36.     oldTicks=TickCount();
  37. }
  38.  
  39. void TimeCorrection(int tickCount)
  40. {
  41.     long        newTicks;
  42.     
  43.     newTicks=TickCount();
  44.     while (newTicks-oldTicks<tickCount)
  45.     {
  46.         Delay(1L, &newTicks);
  47.     }
  48. }